Component({
  data: {
    clientRect: {},
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    list: [{
      pagePath: "/pages/index/index",

      text: "组件"
    }, {
      pagePath: "/pages/story/index",
      text: "接口"
    }]
  },
  attached() {
    const ClientRect =  wx.getStorageSync('ClientRect')
    this.setData({
      'clientRect': ClientRect,
      'selected': getApp().globalData.selected
    })
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      getApp().globalData.selected = data.index
      wx.switchTab({url})
    }
  }
})